package com.aaa.service.impl;

import com.aaa.dao.PhoneDao;
import com.aaa.entity.PhoneInfo;
import com.aaa.service.PhoneService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class PhoneServiceImpl implements PhoneService {
    @Resource
    private PhoneDao phoneDao;

    @Override
    @Cacheable(key = "'list'",value = "phone")
    public List<Map> FindAllPhone() {
        return phoneDao.FindAllPhone();
    }

    @Override
    @CacheEvict(key = "'list'",value = "phone")
    public int AddPhone(PhoneInfo phoneInfo) {
        return phoneDao.AddPhone(phoneInfo);
    }
}
